﻿@{
    ViewBag.Title = "Index";
}
<link href="~/Content/css/framework-theme.css" rel="stylesheet" />
<link href="~/Content/select2/select2.min.css" rel="stylesheet" />

@this.Partial("Index_js")
<style type="text/css">

    .img_thum {
        width: 100px;
        margin-right: 5px;
    }

    .img_red {
        border: 1px solid #ff6a00;
    }
</style>
<div style="width:100%;">
    <div class="topPanel">
        <div class="toolbar">
            <a class="a-btn-refresh" onclick="$ace.reload()"></a>
            <button class="a-btn-edit" data-bind="click:edit,disable:!dataTable.selectedModel()">修改</button>
            <button class="a-btn-add" data-bind="click:add">添加</button>
            <button class="a-btn-delete" data-bind="click:del,disable:!dataTable.selectedModel()">删除</button>
            <button class="a-btn-edit" data-bind="click:openRevisePasswordDialog,disable:!dataTable.selectedModel()" style="display:none;">重置密码</button>
            <button class="a-btn-info" onclick="window.location.href = '/Wiki/Users/log';">充值记录</button>
        </div>
        <div class="search">
            <table class="form-table" style="width:auto;">
                <tr>
                    <td class="form-value">
                        <select class="a-control" data-bind="options:_sts,optionsText:'text',optionsValue:'id',optionsCaption:'--选择状态--',value:searchModel().ST"></select>
                    </td>
                    <td class="form-value">
                        <select class="a-control" data-bind="options:_roles,optionsText:'RoleName',optionsValue:'ID',optionsCaption:'--选择角色--',value:searchModel().RoleID"></select>
                    </td>
                    <td>
                        <input type="text" class="a-control" placeholder="请输入要查询关键字" style="width: 200px;" data-bind="value:searchModel().keyword">
                    </td>
                    <td>
                        <button type="button" class="a-btn-search" data-bind="click:search"></button>
                    </td>
                </tr>
            </table>
        </div>
    </div>


    <div>
        <table class="table table-hover" data-bind="with:dataTable">
            <thead>
                <tr>
                    <th style="width:20px;"></th>
                    <th>编号</th>
                    <th>手机号码</th>
                    <th>微信名称</th>
                    <th>姓名</th>
                    <th>等级</th>
                    <th>状态</th>
                    <th>注册时间</th>
                    <th>会员到期时间</th>
                </tr>
            </thead>
            <tbody data-bind="foreach:models">
                <tr data-bind="click:$parent.selectRow">
                    <td data-bind="text:$parent.getOrdinal($index())"></td>
                    <td data-bind="text:Id"></td>
                    <td data-bind="text:Mobile"></td>
                    <td data-bind="text:UserName"></td>
                    <td data-bind="text:TrueName"></td>
                    <td data-bind="text:$ace.findName(_roles,RoleID(),'ID','RoleName')"></td>
                    <td data-bind="text:$ace.findName(_sts,ST(),'id','text')"></td>
                    <td data-bind="dateString:CreateDate"></td>
                    <td data-bind="dateString:RoleDate"></td>
                </tr>
            </tbody>
            @this.Partial("_tfoot")
        </table>
    </div>
</div>
<dialogbox data-bind="with:dialog" style="width:70%;">
    <form id="form1">
        <div class="content-tabs">
            <nav class="page-tabs menuTabs">
                <div class="page-tabs-content" style="margin-left: 0px;">
                    <a href="javascript:;" class="menuTab active">基本信息</a>
                    <a href="javascript:;" class="menuTab">充值信息</a>
                </div>
            </nav>
        </div>

        <div class="pro_tab">
            <table class="form-table">
                <tr>
                    <td class="form-title">手机号码</td>
                    <td class="form-value">
                        <input name="Mobile" id="Mobile" type="text" class="a-control required" placeholder="" data-bind="value:model().Mobile" />
                    </td>
                </tr>
                <tr>
                    <td class="form-title">微信名称</td>
                    <td class="form-value">
                        <input name="UserName" id="UserName" type="text" class="a-control required" placeholder="" data-bind="value:model().UserName" />
                    </td>
                </tr>
                <tr>
                    <td class="form-title">OpenID</td>
                    <td class="form-value">
                        <input name="OpenID" id="OpenID" type="text" readonly class="a-control required" placeholder="" data-bind="value:model().OpenID" />
                    </td>
                </tr>
                <tr>
                    <td class="form-title">等级</td>
                    <td class="form-value">
                        <select class="a-control" name="RoleID" id="RoleID" data-bind="options:_roles,optionsText:'RoleName',optionsValue:'ID',optionsCaption:'--选择--',value:model().RoleID"></select>
                    </td>
                </tr>
                <tr>
                    <td class="form-title">状态</td>
                    <td class="form-value">
                        <select class="a-control" name="ST" id="ST" data-bind="options:_sts,optionsText:'text',optionsValue:'id',optionsCaption:'--选择--',value:model().ST"> </select>
                    </td>
                </tr>


                <tr>
                    <td class="form-title">姓名</td>
                    <td class="form-value">
                        <input name="TrueName" id="TrueName" type="text" class="a-control required" data-bind="value:model().TrueName" />
                    </td>
                </tr>

                <tr>
                    <td class="form-title">区域</td>
                    <td class="form-value">
                        <select class="a-control" id="Sel_ProvinceID" data-bind="options:_sel_districts1,optionsText:'Name',optionsValue:'ID',optionsCaption:'--选择--',value:model().ProvinceID" style="width:33%;"></select>
                        <select class="a-control" id="Sel_CityID" data-bind="options:_sel_districts2,optionsText:'Name',optionsValue:'ID',optionsCaption:'--选择--',value:model().CityID" style="width:33%;"></select>
                        <select class="a-control" id="Sel_PartID" data-bind="options:_sel_districts3,optionsText:'Name',optionsValue:'ID',optionsCaption:'--选择--',value:model().PartID" style="width:33%;"></select>
                    </td>
                </tr>



                <tr>
                    <td class="form-title">公司名称</td>
                    <td class="form-value">
                        <input name="CompanyName" id="CompanyName" type="text" class="a-control required" placeholder="" data-bind="value:model().CompanyName" />
                    </td>
                </tr>
                <tr>
                    <td class="form-title">业务范围</td>
                    <td class="form-value">
                        <input name="Service" id="Service" type="text" class="a-control required" placeholder="" data-bind="value:model().Service" />
                    </td>
                </tr>
                <tr>
                    <td class="form-title">职业</td>
                    <td class="form-value">
                        <input name="Job" id="Job" type="text" class="a-control required" placeholder="" data-bind="value:model().Job" />
                    </td>
                </tr>
                <tr>
                    <td class="form-title">电话</td>
                    <td class="form-value">
                        <input name="Tel" id="Tel" type="text" class="a-control required" placeholder="" data-bind="value:model().Tel" />
                    </td>
                </tr>
                <tr>
                    <td class="form-title">发动机型号</td>
                    <td class="form-value">
                        <input name="Code" id="Code" type="text" class="a-control required" placeholder="" data-bind="value:model().Code" />
                    </td>
                </tr>
                <tr>
                    <td class="form-title">车牌</td>
                    <td class="form-value">
                        <input name="CarNum" id="CarNum" type="text" class="a-control required" placeholder="" data-bind="value:model().CarNum" />
                    </td>
                </tr>
                <tr>
                    <td class="form-title">收货地址</td>
                    <td class="form-value">
                        <input name="Address" id="Address" type="text" class="a-control required" placeholder="" data-bind="value:model().Address" />
                    </td>
                </tr>


                <tr style="display:none;">
                    <td class="form-title"></td>
                    <td class="form-value">
                        <input name="FromID" id="FromID" type="text" class="a-control required" placeholder="" data-bind="value:model().FromID" />
                        <input name="OpenID" id="OpenID" type="text" class="a-control required" placeholder="" data-bind="value:model().OpenID" />
                    </td>
                </tr>

            </table>
        </div>
        <div class="pro_tab" style="display:none;">

            <table class="table table-hover">
                <thead>
                    <tr>
                        <th>充值项目</th>
                        <th>充值时间</th>
                        <th>充值金额</th>
                        <th>有效期</th>
                    </tr>
                </thead>
                <tbody id="paylog"></tbody>
            </table>
        </div>


    </form>
</dialogbox>


<dialogbox data-bind="with:revisePasswordDialog" style="width:500px">
    <form id="RevisePasswordForm">
        <table class="form">
            <tr>
                <td class="form-title">用户名</td>
                <td class="form-value">
                    <input name="Mobile" disabled type="text" class="a-control" data-bind="value:model().Mobile" />
                </td>
            </tr>
            <tr>
                <td class="form-title">姓名</td>
                <td class="form-value">
                    <input name="UserName" disabled type="text" class="a-control" data-bind="value:model().UserName" />
                </td>
            </tr>
            <tr>
                <td class="form-title">密码</td>
                <td class="form-value">
                    <input name="UserPass" type="password" class="a-control" placeholder="请输入新密码" data-bind="value:model().UserPass" />
                </td>
            </tr>
        </table>
    </form>
</dialogbox>
<script type="text/javascript">
    jQuery(function () {
        jQuery(".menuTab").click(function () {
            var i = jQuery(this).index();

            jQuery(".menuTab").removeClass("active");
            jQuery(this).addClass("active");

            jQuery(".pro_tab").hide();
            jQuery(".pro_tab").eq(i).show();
        });
    });

</script>
